/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package libs.Clases;

/**
 *
 * @author PHENOM II
 */
public class Hero {

    private String Name;
//Stats
    private int Kills;
    private int Deaths;
    private int Assists;
//StatsCreeps
    private int CreepKills;
    private int CreepDenies;
    private int NeutralKills;
//Stats games
    private int gameCount;
    private int Wins;
    private int Loses;
    private int Draws;
    private int Left;

    public Object getTotalValueAt(int col) {
        switch (col) {
            case 0:
                return Name;
            case 1:
                return Kills;
            case 2:
                return Deaths;
            case 3:
                return Assists;
            case 4:
                return CreepKills;
            case 5:
                return CreepDenies;
            case 6:
                return NeutralKills;
            case 7:
                return gameCount;
            case 8:
                return Wins;
            case 9:
                return Loses;
            case 10:
                return Left;
            case 11:
                return Draws;
            default:
                return "N/D";
        }
    }
    // {"Name", "Kills", "Deaths", "Assists",",K/D","A/D","CreepKills", "CreepDenies","CK/CD",
    //    "NeutralKills", "GameCount", "Wins", "Loses", "Left", "Draws"};

    public Object getAverageValueAt(int col) {
        Double value;
        switch (col) {
            case 0:
                return Name;
            case 1:
                value = 1.0 * Kills;
                break;
            case 2:
                value = 1.0 * Deaths;
                break;
            case 3:
                value = 1.0 * Assists;
                break;
            case 4:
                return round((1.0 * Kills) / Deaths);
            case 5:
                return round((1.0 * Assists) / Deaths);
            case 6:
                value = 1.0 * CreepKills;
                break;
            case 7:
                value = 1.0 * CreepDenies;
                break;
            case 8:
                return round((1.0 * CreepKills) / CreepDenies);
            case 9:
                value = 1.0 * NeutralKills;
                break;
            case 10:
                return round(100.0 * Wins / gameCount);
            case 11:
                return round(100.0 * Loses / gameCount);

            case 12:
                return round(100.0 * Left / gameCount);
            case 13:
                return round(100.0 * Draws / gameCount);
            case 14:
                return gameCount;
            default:
                return "N/D";
        }
        return round(value / gameCount);
    }

    public static double round(double a) {
        a *= 100;
        a = Math.round(a);
        a /= 100;
        return a;
    }

    public Hero(String name) {
        Name = name;
    }

    //<editor-fold defaultstate="collapsed" desc="GETTERS">
    public int getAssists() {
        return Assists;
    }

    public int getCreepDenies() {
        return CreepDenies;
    }

    public int getCreepKills() {
        return CreepKills;
    }

    public int getDeaths() {
        return Deaths;
    }

    public int getDraws() {
        return Draws;
    }

    public int getKills() {
        return Kills;
    }

    public int getLeft() {
        return Left;
    }

    public int getLoses() {
        return Loses;
    }

    public String getName() {
        return Name;
    }

    public int getNeutralKills() {
        return NeutralKills;
    }

    public int getWins() {
        return Wins;
    }

    public int getGameCount() {
        return gameCount;
    }
    //</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="Adders">

    public void addAssists(int Assists) {
        this.Assists += Assists;
    }

    public void addCreepDenies(int CreepDenies) {
        this.CreepDenies += CreepDenies;
    }

    public void addCreepKills(int CreepKills) {
        this.CreepKills += CreepKills;
    }

    public void addDeaths(int Deaths) {
        this.Deaths += Deaths;
    }

    public void addKills(int Kills) {
        this.Kills += Kills;
    }

    public void addDraws(int Draws) {
        this.Draws += Draws;
    }

    public void addDraws() {
        this.Draws++;
    }

    public void addLeft(int Left) {
        this.Left += Left;
    }

    public void addLeft() {
        this.Left++;
    }

    public void addLoses(int Loses) {
        this.Loses += Loses;
    }

    public void addLoses() {
        this.Loses++;
    }

    public void addWins(int Wins) {
        this.Wins += Wins;
    }

    public void addWins() {
        this.Wins++;
    }

    public void addGameCount(int gameCount) {
        this.gameCount += gameCount;
    }

    public void addGameCount() {
        this.gameCount++;
    }

    public void addNeutralKills(int NeutralKills) {
        this.NeutralKills += NeutralKills;
    }
    //</editor-fold>
/*
    public void parseLine(String[] data) {
    //        *  Data on every line
    //         *  0=GameTIme         *  1=GameName         *  2=GameType         *  3=Icon
    //         *  4=HeroName         *  5=Kill         *  6=Death         *  7=Assist
    //         *  8=K/D Ratio         *  9=Creep kills         * 10=Creep deny
    //         * 11=Neutral kills         * 12=End state
    
    addGameCount();
    addKills(Integer.valueOf(data[5]).intValue());
    addDeaths(Integer.valueOf(data[6]).intValue());
    addAssists(Integer.valueOf(data[7]).intValue());
    addCreepKills(Integer.valueOf(data[9]).intValue());
    addCreepDenies(Integer.valueOf(data[10]).intValue());
    addNeutralKills(Integer.valueOf(data[11]).intValue());
    String result = data[12];
    if (result.equalsIgnoreCase("WON")) {
    addWins();
    } else if (result.equalsIgnoreCase("LOST")) {
    addLoses();
    } else if (result.equalsIgnoreCase("LEAVER")) {
    addLeft();
    } else if (result.equalsIgnoreCase("DRAW")) {
    addDraws();
    }
    }
     */
}
